import { Ref } from 'vue'
import { RouteRecordRaw } from 'vue-router'

export enum MenuStatus {
  DEFAULT = 'default',
  SMALL = 'small'
}

export enum MenuMode {
  COMMON = 'common',
  MODEL = 'model',
  CLASSICS = 'classics'
}

export enum MenuModeName {
  COMMON = '简洁',
  MODEL = '悬浮',
  CLASSICS = '经典'
}

export type MenuInfo = {
  status: MenuStatus
  defaultCollapsed: boolean
  smallCollapsed: boolean
}

export interface MenuState {
  menuMode: MenuMode
  menuInfo: MenuInfo
  menuConfig: MenuConfig
  menuCollapsedHover: string | undefined
  menuCollapsedHoverLink: Array<string>
}

export type MenuCommonConfig = {
  menuModeMode: string
  menuModeName: string
  menuItemIconWidth: number
  menuItemIconSize: number
  menuPadding: string
  menuOpenFixedSwitch: boolean
  menuSwitchWidth: number
  menuItemHeight: number
  menuChildItemHeight: number
  menuWidth: number
  menuCollapsedWidth: number
}

export type MenuModelConfig = {
  menuModeMode: string
  menuModeName: string
  menuItemHeight: number
  menuChildItemHeight: number
  menuPadding: string
  menuItemIconWidth: number
  menuItemIconSize: number
  menuColor: string
  menuHoverColor: string
  menuWidth: number
  menuCollapsedWidth: number
  menuItemWidth: number
  menuLogoWidth: number
  menuLogoHeight: number
}

export type MenuClassicsConfig = {
  menuModeMode: string
  menuModeName: string
  menuItemIconWidth: number
  menuItemIconSize: number
  menuPadding: string
  menuItemHeight: number
  menuChildItemHeight: number
  menuWidth: number
  menuCollapsedWidth: number
}

export type MenuConfig = {
  menuTitle: string
  menuLogo: string
  menuAccordion: boolean
  menuLeftSolid: boolean
  menuCommonConfig: MenuCommonConfig
  menuModelConfig: MenuModelConfig
  menuClassicsConfig: MenuCommonConfig
  menuNoneIconLevel: number
}
export enum FuncTyp {
  MENU = 2,
  CATALOGUE = 1,
  OPERATION = 3
}

export interface MenuProvide {
  routers: RouteRecordRaw
  currentRoutePath: Ref<string>
  parentRoutePathList: Ref<string[]>
  isHiddenRoute: Ref<boolean>
  collapsed: Ref<boolean>
  menuConfig: Ref<
    MenuConfig & (MenuCommonConfig | MenuModelConfig | MenuClassicsConfig)
  >
  parentPathOnNoDisplay: Ref<string>
  goToRoutePage: (route: RouteRecordRaw) => void
  changeMenuSmallCollapsed: (val: boolean) => boolean
  isSmallScreen: () => boolean
  getPath: (route: RouteRecordRaw) => string
}
